﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel.Web;
using BbsbWebService.Service;
using BbsbWebService.Enums;
using BbsbWebService.Classes;

namespace BbsbWebService.Repositories.Client
{
    public class ClientGroupRepository : ClientPowerRepositoryBase<Group>
    {
        public override void Initialise()
        {
            var groups = ClientCommon.Service.GetGroups(GroupType.All);
            foreach (var group in groups)
            {
                Items.Add(new Group
                {
                    Id = group.Id,
                    Name = group.Name,
                    Type = group.Type
                });
            }
        }

        public override void SaveItem(Group group)
        {
            ClientCommon.Service.SaveGroup(group);
        }

        public override void RemoveItem(Group group)
        {
            ClientCommon.Service.RemoveGroup(group);
        }
    }
}
